feat: Allow multiple prefix characters to trigger a suggestion #2896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the
prefixSpace
option in theSuggestion
utility with a new, more flexible option,allowedPrefixes
. This option accepts multiple characters in a string, and allows each one of those characters as a prefix when triggering suggestions.The current
prefixSpace
option is not very flexible, only allowing spaces as the prefix character, or everything else. But we are in the need of something more flexible, where we only allow a certain set of characters to be prefixed before the suggestion trigger character (i.e.@
for the mention extension).The idea here is that we can configure this option to work more like GitHub. For instance, setting
,
, which works exactly like the current default. Setting
allowedPrefixes: ' (['
, suggestions can be triggered if the prefix character is(
or[
. The default isallowedPrefixes: null
, disables the option, and any character is allowed to be a prefix (same as settingprefixSpace: false
in the current implementation).I've also added
allowedPrefixes
to theSuggestion
utility documentation, whereasprefixSpace
was currently missing.